import java.util.Arrays;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 高生平
 * Date: 2025-09-13
 * Time: 10:15
 */
//给定一个整数数组 nums 和一个整数目标值 target，
// 请你在该数组中找出 和为目标值 target 的那 两个 整数，并返回它们的数组下标。
public class Test {
    public static int[] twoSum (int[] nums, int target) {
        int[] ret = new int[2];
        for (int i = 0; i < nums.length - 1; i++) {
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[i] + nums[j] == target) {
                    ret = new int[]{i, j};
                    break;
                }
            }
        }
        return ret;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int[] nums = new int[k];
        for (int i = 0; i < k; i++) {
            nums[i] = sc.nextInt();
        }
        int target = sc.nextInt();
        int[] ret = twoSum(nums, target);
        System.out.println(Arrays.toString(ret));
    }
}
